You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The idea is that you do your transform operation as usual ( scale/ rotate / skew ).
instead of applying the transform to the text, you apply it to the path in the text.
Then you use this function to put the trasnformation in the path segments,
you swap the path segments, you calculate the bounding box again.
And you assign the path to the text.
Eventually having a new path is better so that the text understand that a change happened.
For path on canvas, this code is going to change the path properties, but keeping a correct top/left is a different issue entirely.
Cool, thanks. I will test this evening. Also, what exactly is the advantage to recalculating the path coordinates rather than simply having text respond to a path's scale values?
The difference is that the only way to do that is with uniform scaling, you can't really do anything else.
So you would scale the path, scale the path length values returned from the calculation, and you would be done.
But if you need to do anything else like:
K, I've got the resizing event working although there is the still caching problem to sort out. When all the pieces have come together I'll put together a demo for the website. Are you okay with merging this transformPath function or was this just meant as as an example?
Sorry not following back on pulling out my example. The baby is taking all my time.
Yes this function is good. i have to update the changelog and the JSDOC slightly.
Ping me again if i don't do it today
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@melchiar this utility function would transform a path to a new path that unscaled/unrotate is equivalent to the one scaled/rotated.
I did not try it yet, i ll try to make a test tomorrow with text on a path or other paths effects.